package com.culturalCenter.dataCenter.service.impl.user;

import com.culturalCenter.dataCenter.entity.user.UserActivityLog;
import com.culturalCenter.dataCenter.mapper.user.UserActivityLogMapper;
import com.culturalCenter.dataCenter.service.user.UserActivityLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/****
 * @Author:
 * @Description:UserActivityLog业务层接口实现类
 * @Date
 *****/
@Service
public class UserActivityLogServiceImpl implements UserActivityLogService {

    @Resource
    private UserActivityLogMapper userActivityLogMapper;

    @Override
    public PageInfo<UserActivityLog> findPage(int page, int size) {
        return PageHelper.startPage(page, size).doSelectPageInfo(() -> userActivityLogMapper.findPageAll());
    }

    @Override
    public Integer delete(String id) {
        return userActivityLogMapper.deleteById(id);
    }

    @Override
    public Integer update(UserActivityLog userActivityLog) {
        return userActivityLogMapper.update(userActivityLog);
    }

    @Override
    public Integer add(UserActivityLog userActivityLog) {
        return userActivityLogMapper.insert(userActivityLog);
    }

    @Override
    public UserActivityLog findById(String id) {
        return userActivityLogMapper.queryById(id);
    }

    @Override
    public List<UserActivityLog> findAll(UserActivityLog userActivityLog) {
        return (List<UserActivityLog>) userActivityLogMapper.queryAll(userActivityLog);
    }

    @Override
    public List<UserActivityLog> findByUserIdAndActivityId(String userId, String activityId) {
        return userActivityLogMapper.findByUserIdAndActivityId(userId, activityId);
    }

}
